package com.adingxiong.cft.design.adapter;

/**
 * @ClassName AudioPlayer
 * @Description TODO
 * @Author xiongchao
 * @Date 2021/1/8 15:28
 **/
public class AudioPlayer implements MediaPlayer {

    MediaAdapter adapter;
    @Override
    public void play(String audioType, String fileName) {
        if(audioType.equalsIgnoreCase("mp3")){
            System.out.println("playing mp3 file ,file name is " + fileName );
        } else if (audioType.equalsIgnoreCase("vlc")){
            adapter = new MediaAdapter("vlc");
            adapter.play(audioType,fileName);
        } else if (audioType.equalsIgnoreCase("mp4")){
            adapter = new MediaAdapter("mp4");
            adapter.play(audioType,fileName);
        } else {
            System.out.println("Invalid audioType , play error" + fileName);
        }
    }
}
